# -*- coding: utf-8 -*-
from db.mysql import MysqlClient
from common.helper import Helper
from itertools import product

name = "中华驾意保意外伤害保险"
mysql = MysqlClient()
plan = {
    "planA": {
        "year": ["18-55"],
        "days": ["1y"],
        "people_count":["1"],
        "accident_disable": ["100000"],
        "accident_death": ["500000"],
        "price": ["66.40"]
    },
    "planB": {
        "year": ["18-55"],
        "days": ["1y"],
        "people_count":["1"],
        "accident_disable": ["200000"],
        "accident_death": ["1000000"],
        "price": ["132.80"]
    },
    "planC": {
        "year": ["18-55"],
        "days": ["1y"],
        "people_count":["1"],
        "accident_disable": ["400000"],
        "accident_death": ["2000000"],
        "price": ["256.60"]

    },
    "planD": {
        "year": ["18-55"],
        "days": ["1y"],
        "people_count":["1"],
        "accident_disable": ["600000"],
        "accident_death": ["3000000"],
        "price": ["398.40"]

    },
    "planE": {
        "year": ["18-55"],
        "days": ["1y"],
        "people_count":["1"],
        "accident_disable": ["1000000"],
        "accident_death": ["5000000"],
        "price": ["664.00"]

    }

}
for k in plan:
    for v in product(plan[k]["year"],plan[k]["days"],plan[k]["people_count"],plan[k]["accident_disable"],plan[k]["accident_death"],plan[k]["price"]):
        data = Helper.formatProductInfo(plan[k],v)
        data["name"] = name
        data["company"]= "中华保险"
        Helper.mergeTable(name,mysql,data )
